package com.liliya.servlet.admin;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONString;
import cn.hutool.json.JSONUtil;
import com.liliya.dao.UserDao;
import com.liliya.dao.impl.UserDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2021/1/11 16:12
 */
@WebServlet(urlPatterns = "/admin/reg")
public class UserRegServlet extends HttpServlet {
    private UserDao userDao = new UserDaoImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        resp.setDateHeader("Expires",0 );
        resp.setHeader("Cache-Control","no-cache");
        resp.setHeader("pragma","no-cache");
        boolean reg = userDao.isReg(username);
        resp.getWriter().write(reg+"");
    }
}
